package com.qinglei.recoup.longconn.entity;

import com.qinglei.recoup.longconn.utils.CommonUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;

@EqualsAndHashCode(callSuper = true)
@Data
public class DownCtrlBody extends BodyT {
    private byte[] data;

    public DownCtrlBody(String body) {
        if (StringUtils.isNotEmpty(body)) {
            this.data = CommonUtils.hexStringToBytes(body);
        } else {
            this.data = new byte[]{0};
        }
    }

    public DownCtrlBody() {
        this.data = new byte[]{0};
    }

    @Override
    public byte[] encode() {
        return data;
    }

    @Override
    public void decode(byte[] body) {
    }
}
